#!/usr/bin/python

import os

# Import model
from model.manager import Manager

import clientview
import adminview

# Configure redis
client_key = "Ees6mohn"
admin_key = "Loh8wuo5"
clientview.app.config["REDIS_QUEUE_KEY"] = client_key
adminview.app.config["REDIS_QUEUE_KEY"] = redis_key

if __name__ == "__main__":
    if os.fork() == 0:
        if os.fork() == 0:
            clientview.app.run("0.0.0.0", 5000, debug=True)
        else:
            adminview.app.run("0.0.0.0", 5001, debug=True)
    else:
        # Start manager
        manager = Manager([client_key, admin_key])
        manager.run()
